package pattern.active;

import pattern.command.EatCommand;
import pattern.command.PigEatCommand;

import java.util.Random;

/**
 * 喂猪
 *
 * @author sun.ye
 * @since 2020-07-14 19:29
 */
public class FeedPig {

    private static EatActiveObjectEngine engine = new EatActiveObjectEngine();
    private static boolean allFull = false;

    public void addPig(EatCommand pig){
        engine.addCommand(pig);
    }

    public void feed(){
        engine.run();
    }


    public static void main(String[] args) {
        FeedPig feedPig = new FeedPig();
        Random random = new Random(47);
        for (int i = 0; i < 10 ; i++) {
            PigEatCommand pig = new PigEatCommand("Pig" + i,random.nextInt(200));
            feedPig.addPig(pig);
        }
        feedPig.feed();
    }
}